Owner Resource Not Found (Gateway V2 Connection Mode and Direct Connection Mode): Remaps sub-status to 1003 for requests to child resources against non-existent container.#47604
Merged
xinlian12 merged 22 commits intoAzure:mainfrom Jan 16, 2026
Merged
Conversation
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds sub-status code 1003 (Owner Resource Not Found) for requests to child resources (e.g., documents) when the owning container doesn't exist. The changes ensure proper error reporting across Direct Mode, Gateway V2 Mode, and Gateway Mode connection types.
Key Changes
- Added error mapping logic to set sub-status code 1003 when container resolution fails during child resource operations
- Introduced new
setSubStatusCodemethod in CosmosException API via ImplementationBridgeHelpers - Added comprehensive test coverage for container not found scenarios across different connection modes
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| QueryPlanRetriever.java | Added error mapping to set sub-status 1003 for 404 errors during query plan retrieval |
| RxCollectionCache.java | Added error mapping handlers in collection resolution paths to set sub-status 1003 for child resource operations |
| StaleResourceRetryPolicy.java | Added enclosingOperationTargetResourceType parameter and error mapping logic for retry scenarios |
| RxDocumentClientImpl.java | Updated retry policy instantiation with ResourceType.Document parameter for point operations |
| ImplementationBridgeHelpers.java | Added setSubStatusCode method to CosmosExceptionAccessor interface |
| CosmosException.java | Implemented setSubStatusCode accessor method |
| CosmosNotFoundTests.java | New comprehensive test class covering non-existent and deleted container scenarios |
| FaultInjectionTestBase.java | Enhanced helper methods to support bulk operations and feed range testing |
| StaleResourceExceptionRetryPolicyTest.java | Updated test constructor calls with new null parameter |
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosNotFoundTests.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Outdated
Show resolved
Hide resolved
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosNotFoundTests.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosNotFoundTests.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosNotFoundTests.java
Outdated
Show resolved
Hide resolved
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StaleResourceRetryPolicy.java
Outdated
Show resolved
Hide resolved
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
…into AzCosmos_RemapSubStatusForDocRequestsAgainstNonExistentContainer
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
xinlian12
reviewed
Dec 29, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StaleResourceRetryPolicy.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Dec 29, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StaleResourceRetryPolicy.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Dec 29, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StaleResourceRetryPolicy.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Dec 29, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
|
Azure Pipelines successfully started running 1 pipeline(s). |
xinlian12
reviewed
Dec 30, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Dec 30, 2025
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Dec 30, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/StaleResourceRetryPolicy.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Dec 30, 2025
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java
Outdated
Show resolved
Hide resolved
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
bigdaddykane18
approved these changes
Jan 3, 2026
xinlian12
reviewed
Jan 6, 2026
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxCollectionCache.java
Outdated
Show resolved
Hide resolved
xinlian12
reviewed
Jan 6, 2026
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java
Show resolved
Hide resolved
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The objective of this PR is to add
Owner Resource Not Found(1003) as sub-status code mapping when the owning resource is not found specifically theDocumentCollectionresource. The main motivation is disambiguation - is it the child resource not present (such as a document) or its encapsulating resource such as a container. This can help an application developer debug better.Scenarios tested and fixed
For Direct Mode and Gateway V2 Mode, ensure both container never existed and stale container cache scenarios are appropriately handled.
For Gateway Mode, ensure container never existed scenarios are appropriately handled.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines